home *** CD-ROM | disk | FTP | other *** search
/ PC Media 23 / PC MEDIA CD23.iso / share / prog / anubis / fonts.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-08-04  |  1.1 KB  |  63 lines

  1. // FONTS.H (C) Anubis.Software Abril 1994
  2. // Libreria dedicada a cambiar los fonts, o tipos de letra
  3.  
  4. #ifndef __FONTS.H
  5. #define __FONTS.H
  6.  
  7. #include <dos.h>
  8. #include <stdio.h>
  9. #include <stdlib.h>
  10.  
  11. typedef char font16[16];
  12. typedef font16 font[256];
  13.  
  14. void xchr(int ch, font16 s)
  15. {
  16.     struct REGPACK regs;
  17.  
  18.     regs.r_dx = ch;
  19.     regs.r_ax = 0x1100;
  20.     regs.r_bx = 16*256+8;
  21.     regs.r_cx = 1;
  22.     regs.r_es =FP_SEG(s);
  23.     regs.r_bp =FP_OFF(s);
  24.     intr(0x10,®s);
  25. }
  26.  
  27. void activa_fuente(font fuente)
  28. {
  29.    unsigned char i;
  30.    for (i=0;i < 255;i++)
  31.       xchr(i,fuente[i]);
  32. }
  33.  
  34. void cargar_fuente(char *nombre, font fuente)
  35. {
  36.    FILE *fichero;
  37.    int i,j;
  38.  
  39.    fichero=fopen(nombre,"rb");
  40.    if(!fichero)  {
  41.       printf("Error, no se pudo encontrar %s",nombre);
  42.       exit (1);
  43.    } // end if
  44.       for (i=0;i<256;i++)    {
  45.         for (j=0;j<16;j++)    {
  46.             fuente[i][j] = fgetc(fichero);
  47.         }// end for
  48.     }// end for
  49.    fclose(fichero);
  50. } // end cargar_font
  51.  
  52. /*
  53. main()
  54. {
  55.    font terminal;
  56.    cargar_fuente("c:\\bat\\fonts\\terminal.fnt",terminal);
  57.    activa_fuente(terminal);
  58.    return(0);
  59. }
  60. */
  61. #endif
  62.  
  63.